#pragma once
#include <string>
#include <iostream>
#include <fstream>
#include <sstream>
using namespace std;
#include "glm\glm.hpp"
using namespace glm;
#include "rapidxml.hpp"
using namespace rapidxml;
#include "SceneManager.h"

class XMLFileLoader
{
public:
	XMLFileLoader();
	~XMLFileLoader();

	void setScene(SceneManager *_s){ scene = _s; }

	bool loadFileToScene(const char* _f);

	void verbose(bool _v){ isVerbose = _v; }
private:
	SceneManager* scene;	//pointer to the SceneManager
	bool isVerbose;			//whether to print debug statements

	bool processRenderSettings(xml_node<> *_n);
	bool processShaders(xml_node<> *_n);
	bool processShaderCollection(xml_node<> *_n);
	bool processFrames(xml_node<> *_n);
	bool processFrame(xml_node<> *_n);
	bool processCamera(xml_node<> *_n);
	bool processShapes(xml_node<> *_n);
	bool processShape(xml_node<> *_n);
	bool processLights(xml_node<> *_n);
	bool processLight(xml_node<> *_n);
	bool processPointLight(xml_node<> *_n);

	bool getVec3(xml_node<> *_n, vec3 &_v);
	bool getVec4(xml_node<> *_n, vec4 &_v);

	string outFile;
	int curFrame;	//for storing a frame number if the file specifies one
};

